var TableManaged = function () {

    return {

        //main function to initiate the module
        init: function () {
            
            if (!jQuery().dataTable) {
                return;
            }

            
            // begin second table
            $('#sample_2').dataTable({
            	"bProcessing": true,   //显示是否加载
                "bDestroy":true,
                "bInfo": true,//页脚信息
                "bAutoWidth": true,//自动宽度
                "sAjaxSource":i1510.contextPath+"/admin/wxTextMessage/jqList.do",
                "bServerSide":true,//打开服务器模式，这个是最重要的</font>
                "fnServerData": function ( sSource, aoData, fnCallback ) {
                	$.ajax( {
	                	"dataType": "json",
	                	"type": "GET",
	                	"url": sSource,
	                	"data": aoData,
	                	"success": fnCallback
//	                	function(data) {   
//	                        alert(data);
//	                        $("#url_sortdata").val(data.aaData);  
//	                        fnCallback(data); //服务器端返回的对象的returnObject部分是要求的格式     
//	                    }     
                	} );
                },
                "bLengthChange":true, //改变每页显示数据数量
                "bFilter": true, //过滤功能
                "bSort": true, //排序功能
                "bPaginate": true, //翻页功能
                "aLengthMenu": [
                    [5, 15, 20, -1],
                    [5, 15, 20, "全部"] // change per page values here
                ],
                // set the initial value
                "iDisplayLength": 5,
                "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
                "sPaginationType": "bootstrap",
                "oLanguage": {
                	"sProcessing": "处理中...",//“sProcessing”: “<img src=’./loading.gif’ />”
                    "sLengthMenu": "显示_MENU_项结果",
                    "sZeroRecords":  "没有匹配结果",
                    "sInfo":         "显示第_START_ 至_END_ 项结果，共_TOTAL_ 项",
                    "sInfoEmpty":    "显示第0 至0 项结果，共0 项",
                    "sInfoFiltered": "(由_MAX_项结果过滤)",
                    "sSearch":       "搜索:",
                    "oPaginate": {
                    	"sFirst": "首页",
                    	"sPrevious": "前一页",
                    	"sNext": "后一页",
                    	"sLast": "尾页"
                    }
                },
                "aoColumns": [
							{ "sName": "docSubject" },
							{ "sName": "docSubject" },
							{ "sName": "docCreateTime" },
							{ "sName": "docStatus" }
				],
                "aoColumnDefs": [
                    {
	                    'bSortable': true,
	                    'aTargets': [0]
	                },{
                        'bSortable': false,
                        'aTargets': [1]
                    }
                ]
            });

            jQuery('#sample_2 .group-checkable').change(function () {
                var set = jQuery(this).attr("data-set");
                var checked = jQuery(this).is(":checked");
                jQuery(set).each(function () {
                    if (checked) {
                        $(this).attr("checked", true);
                    } else {
                        $(this).attr("checked", false);
                    }
                });
                jQuery.uniform.update(set);
            });

            jQuery('#sample_2_wrapper .dataTables_filter input').addClass("m-wrap small"); // modify table search input
            jQuery('#sample_2_wrapper .dataTables_length select').addClass("m-wrap small"); // modify table per page dropdown
            jQuery('#sample_2_wrapper .dataTables_length select').select2(); // initialzie select2 dropdown

            
        }

    };

}();